<script setup>
import { ref } from "vue";

const visible = ref(false);
// 快捷键数据，可根据实际功能扩展
const shortcuts = [
  { key: "Ctrl+1", desc: "截图" },
  { key: "Ctrl+2", desc: "聊天室" },
  { key: "F5", desc: "刷新页面" },
  { key: "Ctrl+R", desc: "刷新程序" },
  { key: "F11", desc: "全屏" },
  { key: "Ctrl+M", desc: "最小化" },
  { key: "Ctrl+Q", desc: "退出" },
  // ...可继续补充
];

// 供外部调用
defineExpose({ visible });
</script>

<template>
  <el-dialog
    v-model="visible"
    title="快捷键说明"
    width="400px"
    :close-on-click-modal="true"
    class="shortcut-dialog"
  >
    <el-table
      :data="shortcuts"
      border
      style="width: 100%"
      size="small"
      max-height="500"
    >
      <el-table-column prop="key" label="快捷键" width="120">
        <template #default="scope">
          <el-tag type="info" effect="plain" size="small">{{
            scope.row.key
          }}</el-tag>
        </template>
      </el-table-column>
      <el-table-column prop="desc" label="功能" />
    </el-table>
    <template #footer>
      <el-button type="primary" @click="visible = false">关闭</el-button>
    </template>
  </el-dialog>
</template>

<style scoped lang="scss">
.shortcut-dialog {
  .el-dialog__header {
    background: #f6faff;
    border-radius: 16px 16px 0 0;
    color: #1976d2;
    font-weight: bold;
    font-size: 18px;
    border-bottom: 1px solid #e0eaff;
  }
  .el-dialog__body {
    background: #fff;
    border-radius: 0 0 16px 16px;
    padding: 18px 18px 8px 18px;
  }
  .el-table {
    background: #f6faff;
    border-radius: 12px;
    font-size: 15px;
    .el-table__header th {
      background: #e3f0ff;
      color: #1976d2;
      font-weight: 500;
      border-bottom: 1px solid #e0eaff;
    }
    .el-table__row {
      background: #fff;
      &:hover {
        background: #e3f0ff;
      }
    }
    .el-tag {
      border: 1px solid #b3d8ff;
      background: #f6faff;
      color: #409eff;
      font-size: 13px;
      border-radius: 8px;
      padding: 2px 10px;
    }
  }
  .el-dialog__footer {
    background: #f6faff;
    border-radius: 0 0 16px 16px;
    text-align: right;
    padding: 12px 18px;
  }
}
</style>
